//
//  ZZLoginViewController.swift
//  网易微博
//
//  Created by gazyy1 on 16/6/25.
//  Copyright © 2016年 gazyy1. All rights reserved.
//

import UIKit

class ZZLoginViewController: UIViewController {
    
//    App Key：415010460
//    App Secret：71df7b7b7b2b00a1d9ba10dc74492384

    lazy var webView : UIWebView = {
        
        let view = UIWebView()
        let APPKEY = "415010460"
//        let APPSECRET = "71df7b7b7b2b00a1d9ba10dc74492384"
        let REDIRECT_URI = "http://www.baidu.com"
        let url = NSURL(string: "https://api.weibo.com/oauth2/authorize?client_id=\(APPKEY)&redirect_uri=\(REDIRECT_URI)")!
        
        let request = NSURLRequest(URL: url)
        view.loadRequest(request)
        
        return view
    }()

    override func loadView() {
//        super.loadView()
        
        view = webView
        view.backgroundColor = UIColor.whiteColor()
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: UIBarButtonItemStyle.Plain, target: self, action: "cancelClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "自动填充", style: UIBarButtonItemStyle.Plain, target: self, action: "writeButtonClick")
        
        
    }
    
    @objc private func cancelClick(){
        dismissViewControllerAnimated(true, completion: nil)
    }
    
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
